import axios from 'axios';
// axios.defaults.withCredentials=true;

let host = window.location.host;

let setHost = (host) => {
    switch(host){
        // case 'pay.dfjmdigital.com': return 'http://pay.dfjmdigital.com';
        default: return 'http://10.10.10.140:8088';
        // default:  return 'http://pay.dfjmdigital.com';
    }
}
const base = setHost(host) + '/cam/public/index.php';

export const imgSrc = setHost(host) + '/cam/public/index.php';
export const zipUrl = base;
// export const requestLogin = params => { return axios.get(`${base}/user/index/submit`, { params: params }); };

// 用户模块
// 登录
export const submit = params => {
	return axios.post(`${base}/user/index/submit?`, params).then(res => res.data);
};
// 注册
export const register = params => {
  	return axios.post(`${base}/user/index/register?`, params).then(res => res.data);
};
// 注册
export const register2 = params => {
  	return axios.post(`${base}/user/index/register2`, params).then(res => res.data);
};

// 退出登录
export const logout = params => {
  	return axios.get(`${base}/user/index/logout`, {params: params}).then(res => res.data);
};

// 版权登记
// 获取版权登记流水号
export const getStreamnum = params => {
  	return axios.get(`${base}/copyright/Index/getStreamnum`, {params: params}).then(res => res.data);
};
// 添加作者接口
export const addAuthor = params => {
  	return axios.get(`${base}/author/Index/addAuthor`, {params: params}).then(res => res.data);
};
// 作者信息列表
export const authorlist = params => {
  	return axios.get(`${base}/author/Index/authorlist`, {params: params}).then(res => res.data);
};
// 删除作者信息
export const authordel = params => {
  	return axios.get(`${base}/author/Index/authordel`, {params: params}).then(res => res.data);
};
// 修改作者信息
export const authorup = params => {
  	return axios.get(`${base}/author/Index/authorup`, {params: params}).then(res => res.data);
};
// 添加著作权人
export const addowner = params => {
  	return axios.get(`${base}/rightowner/Index/addowner`, {params: params}).then(res => res.data);
};
// 著作权人信息列表
export const ownerlist = params => {
 	return axios.get(`${base}/rightowner/Index/ownerlist`, {params: params}).then(res => res.data);
};
// 删除著作权人
export const ownerdel = params => {
 	return axios.get(`${base}/rightowner/Index/ownerdel`, {params: params}).then(res => res.data);
};
// 版权登记第一步&第二步&第三步&第四步
export const ownerup = params => {
  	return axios.get(`${base}/rightowner/Index/ownerup`, {params: params}).then(res => res.data);
}; // 修改著作权人
export const autosubmit = params => {
  	return axios.get(`${base}/copyright/Index/autosubmit`, {params: params}).then(res => res.data);
};
// 上一步或修改接口
export const front = params => {
  	return axios.get(`${base}/copyright/Index/front`, {params: params}).then(res => res.data);
};

export const look = params => {
  	return axios.get(`${base}/copyright/Index/look`, {params: params}).then(res => res.data);
}; // 预览

// 上传接口
export const submitfile = `${base}/Uploads/uploads/submitfile`; // 上传接口(post接值)
// 个人中心--> 版权登记
export const userregister = params => {
  	return axios.get(`${base}/copyright/Index/registerorder`, {params: params}).then(res => res.data);
};

// 个人中心--> 版权存正
export const orderlist = params => {
  	return axios.get(`${base}/copyright/Index/orderlist`, {params: params}).then(res => res.data);
};

//个人中心-->  删除
export const userDel = params => {
  	return axios.get(`${base}/Copyright/index/del`, {params: params}).then(res => res.data);
};

// 添加监测需求
export const requiresAdd = params => {
  	return axios.get(`${base}/requires/index/add`, {params: params}).then(res => res.data);
};

//上传申请表签字
export const signupload = params => {
  	return axios.get(`${base}/copyright/Index/signupload`, {params: params}).then(res => res.data);
};


// 实名认证
export const submitreal = params => {
  	return axios.get(`${base}/user/index/submitreal`, {params: params}).then(res => res.data);
};

// 继续填写
export const continuesubmit = params => {
  	return axios.get(`${base}/copyright/Index/continuesubmit`, {params: params}).then(res => res.data)
};


// 新版
export const isreal = params => {
  	return axios.get(`${base}/copyright/Index/isreal`, {params: params}).then(res => res.data);
};
// 上传
export const submitApi = params => {
  	return axios.get(`${base}/copyright/Index/submit`, {params: params}).then(res => res.data);
};
// 修改
export const update = params => {
  	return axios.get(`${base}/copyright/Index/update`, {params: params}).then(res => res.data);
};
// 下载样本压缩包
export const downloadzip = params => {
  	return axios.get(`${base}/copyright/index/downloadzip`, {params: params}).then(res => res.data);
};
// 确认并继续
export const confirm = params => {
  	return axios.get(`${base}/copyright/index/confirm`, {params: params}).then(res => res.data);
};


//获取验证码
export const verify = params => {
 	return axios.get(`${base}/user/index/verify`, {params: params}).then(res => res.data);
};

//验证码提交
export const check = params => {
  	return axios.get(`${base}/user/index/check`, {params: params}).then(res => res.data);
};

/**
 * 用户模块 2018-5-14
 */
// 用户登录
export const submit = params => { return axios.post(`${base}/user/userfront/submit?`, params).then(res => res.data); };
// 用户注册
export const register = params => { return axios.post(`${base}/user/userfront/register?`, params).then(res => res.data); };
// 获取cookies
export const getlogincookie = params => { return axios.get(`${base}/user/userfront/getlogincookie`, {params: params}).then(res => res.data); };
// 退出登录
export const getlogincookie = params => { return axios.get(`${base}/user/index/logout`, {params: params}).then(res => res.data); };
// 获取验证码
export const check = params => { return axios.get(`${base}/user/userfront/check`, {params: params}).then(res => res.data); };
// 获取个人信息
export const getinfo = params => { return axios.get(`${base}/user/userfront/getinfo`, {params: params}).then(res => res.data); };
// 修改用户名
export const update = params => { return axios.get(`${base}/user/userfront/update`, {params: params}).then(res => res.data); };
// 修改密码
export const resetpw = params => { return axios.get(`${base}/user/userfront/resetpw`, {params: params}).then(res => res.data); };

/**
 * 用户实名认证
 */
// 提交实名认证信息
export const identityAdd = params => { return axios.get(`${base}/identity/index/add`, {params: params}).then(res => res.data); };
// 获取认证信息
export const identityGet = params => { return axios.get(`${base}/identity/index/getinfo`, {params: params}).then(res => res.data); };
// 获取认证信息
export const identityGet = params => { return axios.get(`${base}/identity/index/getinfo`, {params: params}).then(res => res.data); };

/**
 * 版权监测
 */
// 提交监测需求
export const requiresAdd = params => { return axios.get(`${base}/requires/index/add`, {params: params}).then(res => res.data); };
// 更新监测需求
export const requiresEdit = params => { return axios.get(`${base}/requires/index/edit`, {params: params}).then(res => res.data); };
// 获取监测需求
export const requiresGetdetail = params => { return axios.get(`${base}/requires/index/getdetail`, {params: params}).then(res => res.data); };
// 删除
export const requiresDel = params => { return axios.get(`${base}/requires/index/del`, {params: params}).then(res => res.data); };
// 获取用户所有监测需求
export const requiresGetlist = params => { return axios.get(`${base}/requires/index/getlist`, {params: params}).then(res => res.data); };

/**
 * 用户上传盗版接口
 */
// 验证录入的URL域名是否在正版地址里,是否已经录入过
export const unauthCheckurl = params => { return axios.get(`${base}/unauth/index/checkurl`, {params: params}).then(res => res.data); };
// 添加盗版作品链接
export const unauthAdd = params => { return axios.get(`${base}/unauth/index/add`, {params: params}).then(res => res.data); };
// 获取一条录入详情
export const unauthGetinfo = params => { return axios.get(`${base}/unauth/index/getinfo`, {params: params}).then(res => res.data); };
// 编辑
export const unauthEdit = params => { return axios.get(`${base}/unauth/index/edit`, {params: params}).then(res => res.data); };
// 删除
export const unauthDel = params => { return axios.get(`${base}/unauth/index/del`, {params: params}).then(res => res.data); };
// 获取用户的录入列表
export const unauthGetlist = params => { return axios.get(`${base}/unauth/index/getlist`, {params: params}).then(res => res.data); };

/**
 * 上传接口()post接值)
 */
export const submitfile = params => { return axios.post(`${base}uploads/uploads/submitfile`, params).then(res => res.data); };






